<?php
/**
 * Copyright (c) 2017. 上海业晋信息技术有限公司 www.yejinsoft.com
 */

namespace App\Http\Requests\V1;

class FacultyRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return parent::authorize();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = parent::rules();
        $rules['code'] = 'bail|required|exists:basic_faculties,code,deleted_at,NULL';
        return $rules;
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array
     */
    public function messages()
    {
        $messages = parent::messages();
        $messages['code.required'] = '教职工代码不能为空';
        $messages['code.exists'] = '教职工代码不存在';
        $messages['name.required'] = '教职工姓名不能为空';
        $messages['captcha.required'] = '验证码不能为空';
        $messages['captcha.captcha'] = '验证码错误';
        return $messages;
    }
}
